package dj.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * Tuser entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tuser", catalog = "", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Tuser implements java.io.Serializable {

	// Fields

	private String id;
	private Date createDate;
	private String displayName;
	private String name;
	private String pwd;
	private Integer userState;
	private String userType;
	private String parentid;
	private Set<Friend> friends = new HashSet<Friend>(0);
	private Set<UserExtend> userExtends = new HashSet<UserExtend>(0);

	// Constructors

	/** default constructor */
	public Tuser() {
	}

	/** minimal constructor */
	public Tuser(String id, String name, String pwd, Integer userState, String userType) {
		this.id = id;
		this.name = name;
		this.pwd = pwd;
		this.userState = userState;
		this.userType = userType;
	}

	/** full constructor */
	public Tuser(String id, Date createDate, String displayName, String name, String pwd, Integer userState, String userType, String parentid, Set<Friend> friends, Set<UserExtend> userExtends) {
		this.id = id;
		this.createDate = createDate;
		this.displayName = displayName;
		this.name = name;
		this.pwd = pwd;
		this.userState = userState;
		this.userType = userType;
		this.parentid = parentid;
		this.friends = friends;
		this.userExtends = userExtends;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "createDate", length = 10)
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "displayName", length = 100)
	public String getDisplayName() {
		return this.displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	@Column(name = "name", unique = true, nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "pwd", nullable = false, length = 100)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "userState", nullable = false)
	public Integer getUserState() {
		return this.userState;
	}

	public void setUserState(Integer userState) {
		this.userState = userState;
	}

	@Column(name = "userType", nullable = false, length = 20)
	public String getUserType() {
		return this.userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	@Column(name = "parentid", length = 36)
	public String getParentid() {
		return this.parentid;
	}

	public void setParentid(String parentid) {
		this.parentid = parentid;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tuser")
	public Set<Friend> getFriends() {
		return this.friends;
	}

	public void setFriends(Set<Friend> friends) {
		this.friends = friends;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tuser")
	public Set<UserExtend> getUserExtends() {
		return this.userExtends;
	}

	public void setUserExtends(Set<UserExtend> userExtends) {
		this.userExtends = userExtends;
	}

}